<div id="wrapper">
	<div id="header-wrapper"></div>
</div>


<div id="header">
	<div id="logo">
		<img src="images/InspectorTransparent.png" id="logo" /><a
			href="UserMainPage.jsp">QR MARKS THE SPOT</a>
	</div>

	<%
		if (session.getAttribute("nickname") == null) {
	%>

	<form name="login" method="post" action="LoginServe">
		<div id="login">
			<table>
				<tr>
					<td class="login-label">Username:</td>
					<td><input type="text" name="nickname" class="login-text" /></td>
				</tr>
				<tr>
					<td class="login-label">Password:</td>
					<td><input type="password" name="password" class="login-text" /></td>
					<td><input type="submit" value="Login" id="login-button" /></td>
				</tr>
			</table>
		</div>
	</form>
</div>
<!-- END HEADER -->

<% if(session.getAttribute("error_msg")!=null){ %>
<div class="information-text">
		<table align="center">
			<tr>
				<td><font color=#D14836>${error_msg}</font></td>
			</tr>
		</table>
		</div>

<% } %>

<div id="signup-remind" align="center">
	<div>
		You are not a member yet? Go <a href="SignUp.jsp"
			onclick="return loadIframe('ifrm', this.href)">Sign Up</a> now!
	</div>
</div>
<%
	}

	else {
		String name = (String) session.getAttribute("nickname");
		session.setAttribute("nickname", name);
		session.setAttribute("error_msg",null); //for log in error
%>
<div id="username">
	<div>
		Welcome <%=name%></div>
	<div>
		<a href="Profile.jsp"
			onclick="return loadIframe('ifrm', this.href)">My Profile</a>
		<a href="index.jsp?logout=true"
			onclick="return loadIframe('ifrm', this.href)">Logout</a>
	</div>
</div>
</div> <!-- Necessary div closer of header -->
<!-- END HEADER -->

<div id="profile-menu">
	<ul>
		<%
			String pageName = request.getRequestURL().toString();
				String[] elements = pageName.split("/");
				pageName = elements[elements.length - 1];
		%>
		<li <%if (pageName.equals("UserMainPage.jsp") || pageName.equals("index.jsp")) {%>
			class="current_page_item" <%}%>><a href="UserMainPage.jsp"
			onclick="return loadIframe('ifrm', this.href)">Main Page</a></li>
		
		<li <%if (pageName.equals("Profile.jsp")) {%>
			class="current_page_item" <%}%>><a href="Profile.jsp"
			onclick="return loadIframe('ifrm', this.href)">Profile Page</a></li>
		
		<li <%if (pageName.equals("ChangePersInfo.jsp")) {%>
			class="current_page_item" <%}%>><a href="ChangePersInfo.jsp"
			onclick="return loadIframe('ifrm', this.href)">Change Information</a></li>

		<li <%if (pageName.equals("UserCreatedGames.jsp")) {%>
			class="current_page_item" <%}%>><a href="UserCreatedGames.jsp"
			onclick="return loadIframe('ifrm', this.href)">Created Games</a></li>

		<li <%if (pageName.equals("RegisteredGames.jsp")) {%>
			class="current_page_item" <%}%>><a href="RegisteredGames.jsp"
			onclick="return loadIframe('ifrm', this.href)">Registered Games</a></li>
	</ul>
</div>


<%
	}
%>
